package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduAddressSchoolDifferentStreetIntegration;
import com.jwsoft.manager.common.vo.eduAddressSchoolDifferentStreet.EduAddressSchoolDifferentStreetVO;
import com.jwsoft.manager.common.vo.eduAddressSchoolDifferentStreet.EduAddressSchoolDifferentStreetKeyVO;
import com.jwsoft.manager.common.vo.eduAddressSchoolDifferentStreet.EduAddressSchoolDifferentStreetQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 同学段不同街道学校关联地址网关
 *
 * @author wangt
 * @since 2024-06-03
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "同学段不同街道学校关联地址", description = "同学段不同街道学校关联地址")
public class EduAddressSchoolDifferentStreetController {

    @Autowired
    public EduAddressSchoolDifferentStreetIntegration eduAddressSchoolDifferentStreetIntegration;

    @Operation(summary = "同学段不同街道学校关联地址分页查询",description = "同学段不同街道学校关联地址分页查询")
    @PostMapping(value = "/addressDifferentStreet0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduAddressSchoolDifferentStreetVO>> getList(@RequestBody @Validated EduAddressSchoolDifferentStreetQueryVO vo) {
        return AppResponse.successData(eduAddressSchoolDifferentStreetIntegration.getList(vo));
    }

    @Operation(summary = "同学段不同街道学校关联地址根据主键查询详情",description = "同学段不同街道学校关联地址根据主键查询详情")
    @PostMapping(value = "/addressDifferentStreet0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduAddressSchoolDifferentStreetVO> getById(@RequestBody @Validated EduAddressSchoolDifferentStreetKeyVO vo) {
        return AppResponse.successData(eduAddressSchoolDifferentStreetIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "同学段不同街道学校关联地址新增",description = "同学段不同街道学校关联地址新增")
    @PostMapping(value = "/addressDifferentStreet0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduAddressSchoolDifferentStreetVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduAddressSchoolDifferentStreetVO vo) {
        return AppResponse.successData(eduAddressSchoolDifferentStreetIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "同学段不同街道学校关联地址修改",description = "同学段不同街道学校关联地址修改")
    @PostMapping(value = "/addressDifferentStreet0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduAddressSchoolDifferentStreetVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduAddressSchoolDifferentStreetVO vo) {
        return AppResponse.successData(eduAddressSchoolDifferentStreetIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "同学段不同街道学校关联地址删除",description = "同学段不同街道学校关联地址删除")
    @PostMapping(value = "/addressDifferentStreet0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduAddressSchoolDifferentStreetKeyVO vo) {
        eduAddressSchoolDifferentStreetIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
